home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / SortLib 2.0 / source / sorttest / ansi.c next >
Encoding:
C/C++ Source or Header  |  1994-10-31  |  985 b   |  47 lines  |  [TEXT/KAHL]

  1. /* Some brain-damaged systems don't have the basic set of ANSI
  2.    functions. These are just functions I had to write myself.
  3.    Your system may need even more standard functions written,
  4.    or it may need less. */
  5.  
  6. #ifndef __STDC__
  7.  
  8. #include <string.h>
  9. #include <time.h>
  10.  
  11. void *memmove(void *dest, const void *src, size_t n)
  12. {
  13.   register char *d, *s;
  14.   void *p;
  15.   
  16.   p = d = dest;
  17.   s = src;
  18.   while (n-- > 0)
  19.     *d++ = *s++;
  20.   return(p);
  21. }
  22.  
  23. #if defined(SYS_UNIX) && ! defined(NeXT) && ! defined(ULTRIX)
  24.  
  25. #include <sys/time.h>
  26.  
  27. extern int gettimeofday(struct timeval *, struct timezone *);
  28.  
  29. clock_t clock(void)
  30. {
  31.   struct timeval tp;
  32.   static clock_t first_sec;
  33.  
  34.   (void) gettimeofday(&tp, NULL);
  35.   if (! first_sec)
  36.     first_sec = tp.tv_sec;
  37.   return((tp.tv_sec - first_sec) * 1000000 + tp.tv_usec);
  38. }
  39.  
  40. #endif /* defined(SYS_UNIX) && ! defined(NeXT) && ! defined(ULTRIX) */
  41.  
  42. #else /* __STDC__ */
  43.  
  44. static char dummy; /* declaration to satisfy some compilers */
  45.  
  46. #endif /* __STDC__ */
  47.